package 基础语法.权限修饰符.包2;

import 基础语法.权限修饰符.包1.Test1;

public class Test2 {
public static void main(String[] args) {
    Test1 test1=new Test1();
    //test1.naDMethod();
    //test1.protectedMethod();
    test1.finalMethod();
    
}
}

class tt extends Test1 {

    @Override public void publicMethod() { }
    //@Override public static void main(String[] a) {}//不可以
    // @Override protected  void protectedMethod() {}
    //@Override protected  final void protectedMethod() {}//可以
    // @Override public void protectedMethod() {}//可以提升
    //@Override private void protectedMethod() {}//不可以降低

    //@Override void naDMethod() {}

    //@Override private void privateDMethod() {}

    //@Override public final void finalMethod() {}
}

/* 无法访问,若都加上public修饰，则可以 访问
class tt1 extends Test1_1{
    @Override
    protected void protectedMethod() {
        // TODO Auto-generated method stub
        System.out.println(Test2.class + "protectedMethod");

    }

    @Override
    void naDMethod() {

    }

    //@Override private void privateDMethod() {System.out.println(Test1.class + "privateDMethod");}

    //@Override public final void finalMethod() {System.out.println(Test1.class + "finalMethod");}
}
class tt2 extends Test1_2{
        @Override
    protected void protectedMethod() {
        // TODO Auto-generated method stub
        System.out.println(Test2.class + "protectedMethod");

    }

    @Override
    void naDMethod() {

    }

    //@Override private void privateDMethod() {System.out.println(Test1.class + "privateDMethod");}

    //@Override public final void finalMethod() {System.out.println(Test1.class + "finalMethod");}
}
 */